//
//  TKYTaskSumCell.m
//  StationHouseHelper
//
//  Created by apple on 2018/7/6.
//  Copyright © 2018年 铁科院. All rights reserved.
//

#import "TKYTaskSumCell.h"
@interface TKYTaskSumCell()


/**
 进度
 */
@property (nonatomic, strong)UIProgressView *progressView;


/**
 数量
 */
@property (nonatomic, strong)UILabel *numLabel;
/**
 分数
 */
@property (nonatomic, strong)UILabel *scoreLabel;


@end
@implementation TKYTaskSumCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.progressView];
        [self.contentView addSubview:self.numLabel];
        [self.contentView addSubview:self.scoreLabel];
        
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).with.offset(kWidthScale *10);
            make.top.equalTo(self.contentView).with.offset(kHeightScale *5);
            make.height.mas_equalTo(kHeightScale *20);
            make.width.mas_equalTo(kWidthScale *60);
        }];
        
        [self.progressView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.titleLabel.mas_right).with.offset(kWidthScale *10);
            make.top.equalTo(self.contentView).with.offset(kHeightScale *15);
            //make.height.mas_equalTo(20);
            make.right.equalTo(self.numLabel.mas_left).with.offset(-kWidthScale *10);

           // make.width.mas_equalTo(100);
        }];
        
        [self.scoreLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView).with.offset(-kWidthScale *10);
            make.top.equalTo(self.contentView).with.offset(kHeightScale *5);
            make.height.mas_equalTo(kHeightScale*20);
            make.width.mas_equalTo(kWidthScale *40);
        }];
        
        [self.numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.scoreLabel.mas_left).with.offset(-kWidthScale *10);
            make.top.equalTo(self.contentView).with.offset(kHeightScale *5);
            make.height.mas_equalTo(kHeightScale *20);
            make.width.mas_equalTo(kWidthScale *40);
        }];
    }
    return self;
}

- (UILabel *)titleLabel{
    if (_titleLabel == nil) {
        _titleLabel = [[UILabel alloc]init];
        _titleLabel.text = @"问题总计:";
        _titleLabel.font = Font(12);
        _titleLabel.textColor = kRGBColor(42, 42, 42, 1);
    }
    return _titleLabel;
}

- (UIProgressView *)progressView{
    if (_progressView == nil) {
        _progressView = [[UIProgressView alloc]init];
        //设定两端弧度
        _progressView.layer.cornerRadius = 3.0;
        self.progressView.layer.masksToBounds = YES;
        //设置进度条的颜色
        _progressView.progressTintColor = kRGBColor(34, 130, 255, 1);
        
        //设置进度条的当前值，范围：0~1；
        _progressView.transform = CGAffineTransformMakeScale(1.0f, 3.0f);
        /*
         typedef NS_ENUM(NSInteger, UIProgressViewStyle) {
         UIProgressViewStyleDefault,     // normal progress bar
         UIProgressViewStyleBar __TVOS_PROHIBITED,     // for use in a toolbar
         };
         */
        _progressView.progressViewStyle = UIProgressViewStyleDefault;
        _progressView.progress = 0.3;
    }
    return _progressView;
}

- (UILabel *)scoreLabel{
    if (_scoreLabel == nil) {
        _scoreLabel = [[UILabel alloc]init];
        _scoreLabel.text = @"20";
        _scoreLabel.font = Font(12);
        _scoreLabel.textColor = kRGBColor(42, 42, 42, 1);
        _scoreLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _scoreLabel;
}

- (UILabel *)numLabel{
    if (_numLabel == nil) {
        _numLabel = [[UILabel alloc]init];
        _numLabel.text = @"12";
        _numLabel.font = Font(12);
        _numLabel.textColor = kRGBColor(42, 42, 42, 1);
        _numLabel.textAlignment = NSTextAlignmentCenter;

    }
    return _numLabel;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
